package com.group.tag;

import javax.servlet.http.HttpSession;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.SimpleTagSupport;

import java.io.IOException;

public class ExitButtonHandler extends SimpleTagSupport {

	//没有使用这个tag，原因是session处理无法避免
    @Override
    public void doTag() throws JspException, IOException {
    	PageContext pageContext = (PageContext) getJspContext();
        HttpSession session = pageContext.getSession();
        // 处理退出按钮的业务逻辑
        session.removeAttribute("user");
        pageContext.getOut().write("<button class=\"btn btn-success btn-block\" onclick=\"exit()\">退出</buttton>");
    }
}
